#include <QApplication>
#include <QTextCodec>

#include "mainwindow.h"
#include "Logger/logger.h"
#include "manager.h"

int main(int argc, char *argv[])
{
    // For correct encoding
    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForCStrings(codec);

    // Creating logger instance
    Logger::CreateInstance();
    //    LOG( "Main", "Created logger" );
    Logger::instance()->add("Main", "Created logger");

    QApplication a(argc, argv);

    Manager::createInstance();
    App->setup();
    App->mainWindow()->show();

    // Run app loop
    int result = a.exec();

    Manager::deleteInstance();

    // Freeing logger instance

    LOG("Main", "Logger deleted");
    Logger::DestroyInstance();

    return result;
}
